Return to start page
Core/Maths/Struct Point.j
1 library AStructCoreMathsPoint requires ALibraryCoreMathsPoint
2
3 struct APoint
4 //dynamic members
5 private real m_x //should be protected
6 private real m_y
7
8 //dynamic members
9
10 public method setX takes real x returns nothing
11 set this.m_x = x
12 endmethod
13
14 public method x takes nothing returns real
15 return this.m_x
16 endmethod
17
18 public method setY takes real y returns nothing
19 set this.m_y = y
20 endmethod
21
22 public method y takes nothing returns real
23 return this.m_y
24 endmethod
25
26 //methods
27
28 public method polarProjectionX takes real angle, real distance returns real
29 return GetPolarProjectionX(this.m_x, angle, distance)
30 endmethod
31
32 public method polarProjectionY takes real angle, real distance returns real
33 return GetPolarProjectionY(this.m_y, angle, distance)
34 endmethod
35
36 public method location takes real angle, real distance returns location
37 return GetPolarProjectionOfPoint(this.m_x, this.m_y, angle, distance)
38 endmethod
39
40 public static method create takes real x, real y returns thistype
41 local thistype this = thistype.allocate()
42 //dynamic members
43 set this.m_x = x
44 set this.m_y = y
45
46 return this
47 endmethod
48 endstruct
49
50 endlibrary
51